<%@ page import="databeans.*"%>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.*" %>
<jsp:include page="../common/messages.jsp"/>
<%
		ArrayList<Integer> transIDs = (ArrayList<Integer>)request.getAttribute("transIDs");
		ArrayList<String> transDates_submit = (ArrayList<String>)request.getAttribute("transDates_submit");
		ArrayList<String> transDates = (ArrayList<String>)request.getAttribute("transDates");
		ArrayList<String> transTypes = (ArrayList<String>)request.getAttribute("transTypes");
		ArrayList<String> fundNames = (ArrayList<String>)request.getAttribute("fundNames");
		ArrayList<Long> numOfShares = (ArrayList<Long>)request.getAttribute("numOfShares");
		ArrayList<Long> amounts = (ArrayList<Long>)request.getAttribute("amounts");
		ArrayList<String> statuses = (ArrayList<String>)request.getAttribute("statuses");
       	if (transTypes.size()==0){
       %>
       <br/>
       <p class="pad-left-20"><b>You have no pending transactions.</b></p>
       <br/>
       <br/>
       &nbsp;
      <%
      }else{
      %>
              <div class="trans-history">
					<table id="trans-history">
						<thead>
					        <tr>
					         	<th>ID</th>
	                           	<th>Submit Date</th>
	                            <th>Type</th>
	                            <th>Fund</th>
	                            <th>Shares</th>
                            	<th>$ Amount</th>
                            	<th>Status</th>
	                        </tr>
				       </thead>
				       <tbody>
				       <%for(int i=0; i<transTypes.size(); i++){ %>
				        <tr>
					         <td><%=transIDs.get(i) %></td>
					         <td><%=transDates_submit.get(i).toString()%></td>
					         <td><%=transTypes.get(i) %></td>
					         <td><%=fundNames.get(i) %></td>
					         
					         <td style="text-align:right;padding-right:10px;"><%if(numOfShares.get(i).doubleValue()==0.00) out.println(" - "); else out.println(helper.Formatter.prepShareToView(numOfShares.get(i))); %></td>
					         <td style="text-align:right;padding-right:10px;"><%if(amounts.get(i).doubleValue()== 0.00) out.println(" - "); else out.println("$" + helper.Formatter.prepCashToView(amounts.get(i))); %></td>
					         <td>
										<%if(statuses.get(i).equals("Pending")) { %>
											<span class="pending pad-left-20">Pending</span>
										<%}else if(statuses.get(i).equals("Approved")){ %>
											<span class="tick pad-left-20">Approved</span>
										<%} %>
									</td>
				        </tr>
				       <% } %>
				       </tbody>
				      </table>
			</div>
			<%} %>